package com.hb.service.leave.impl;

import com.hb.pojo.po.leave.Leave;
import com.hb.pojo.vo.leave.LeaveVo;
import com.hb.pojo.dto.leave.LeaveDto;
import com.hb.service.leave.LeaveService;
import com.hb.mapper.leave.LeaveMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class LeaveServiceImpl implements LeaveService {
    @Resource
    private LeaveMapper leaveMapper;

    @Override
    public Leave selectByPrimaryKey(Integer id) {
        return leaveMapper.selectByPrimaryKey(id);
    }

    @Override
    public Leave insertSelective(LeaveDto leaveDto) {
        int i = leaveMapper.insertSelective(leaveDto);
        return i > 0 ? leaveMapper.selectByPrimaryKey(leaveDto.getLeave_id()) : null;
    }

    @Override
    public Leave updateByPrimaryKeySelective(LeaveVo leaveVo) {
        int i = leaveMapper.updateByPrimaryKeySelective(leaveVo);
        return i > 0 ? leaveMapper.selectByPrimaryKey(leaveVo.getLeave_id()) : null;
    }

    @Override
    public Leave updateByPrimaryKey(LeaveVo leaveVo) {
        int i = leaveMapper.updateByPrimaryKey(leaveVo);
        return i > 0 ? leaveMapper.selectByPrimaryKey(leaveVo.getLeave_id()) : null;
    }


    @Override
    public List<LeaveDto> selectByVo(LeaveVo leaveVo) {
        List<LeaveDto> leaveDtos= leaveMapper.selectByVo(leaveVo);
        return leaveDtos;
    }
}
